home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-03-16 | 5.7 KB | 178 lines | [TEXT/KAHL] |
-
- Change in Exit Handling
- 3/16/89
-
- The 3.02 compiler is incompatible with versions of the C libraries earlier
- than 3.01p4. If you are using older libraries, it is IMPERATIVE that you
- apply the 3.02 library update when you apply the 3.02 patch.
-
- (If you have already upgraded to the 3.01p4 libraries, there is no need to
- upgrade further to 3.02, as there are no substantive changes. However, if
- you prefer to keep current, the differences are summarized at the end of
- this memo.)
-
- Also, this memo contains critical information concerning the behavior of
- your application when it exits. This is information which you MUST KNOW
- if:
-
- (1a) You call the standard library function "onexit", or you use
- stdio, the profiler, or "signal" (each of which calls "onexit").
-
- -or-
-
- (1b) You build applications with the "Separate STRS" option set.
- (This option is frequently set in projects which originated
- prior to THINK C 3.0.)
-
- -and-
-
- (2) Your application can exit by calling "Launch" (or "_Launch").
- (For example, your application may implement a "Transfer"
- menu.)
-
- If you don't use "Launch", or you don't use "onexit" or "Separate STRS",
- then you can get away without reading the rest of this. But please be
- sure to update your libraries no matter what!
-
-
- BACKGROUND
- ----------
-
- The manner in which THINK C applications clean up when they exit changed
- as of version 3.01p4. When using this version (or later), it is
- critical that you avoid using earlier versions of the standard libraries,
- as the implementation of "onexit" has changed in an incompatible way.
-
- In addition, it can no longer be guaranteed that your application will
- be able to clean up if it exits with a "Launch". This may be an issue
- if you are relying on "onexit" to schedule clean-up. Even if you're not
- using "onexit", the runtime system for applications built with "Separate
- STRS" has clean-up of its own to perform at exit.
-
- Previously, the runtime system built into every THINK C application was
- able to arrange for clean-up no matter how the application might exit.
- Unfortunately, the method used to assure this resulted in applications
- which were not "32-bit clean".
-
- The new method is 32-bit clean, but can't catch the case where the
- application exits with a "Launch". (Actually, even this case is caught
- if the application is running under MultiFinder -- though this can't be
- guaranteed for future versions of MultiFinder.)
-
-
- WAYS OF EXITING
- ---------------
-
- Let's define some terms:
-
- "normal exit"
-
- If your application exits by calling the "exit" function, or
- by returning from "main", this is considered a normal exit.
-
- "abnormal exit"
-
- If your application exits by calling "ExitToShell", this is
- considered an abnormal exit. Calling "abort" is covered under
- this definition, as is terminating execution under the control
- of a debugger. (Under the CURRENT implementation of MultiFinder,
- all exits are either normal or abnormal -- even "SysError" ends
- up calling "ExitToShell"! However, this may not be so in the
- future.)
-
- "unsafe exit"
-
- If your application exits by calling "Launch", or in any other
- manner not covered above, this is considered an unsafe exit.
-
-
- ONEXIT AND _ONEXIT
- ------------------
-
- Routines registered with "onexit" will now be called only on normal exits.
- Previously, they were called on any form of exit.
-
- A new routine, "_onexit", is now available. Routines registered with
- "_onexit" will be called on abnormal as well as normal exits.
-
- To summarize:
-
- (1) On a normal exit, routines registered with "onexit" or
- "_onexit" will be called.
-
- (2) On an abnormal exit, routines registered with "_onexit"
- will be called. Routines registered with "onexit" will
- NOT be called.
-
- In both of these cases, the runtime support for "Separate STRS" will be
- given a chance to clean up. (This happens even if you never register any
- clean-up routines of your own.)
-
-
- DEALING WITH UNSAFE EXITS
- -------------------------
-
- If an unsafe exit is taken, no clean-up routines will be called. If you
- have registered essential clean-up routines (e.g. removing trap intercepts
- or other low-memory vectors), or if your application is built using
- "Separate STRS", this could be disastrous.
-
- To deal with this, a new routine, "_exiting", is now available. This
- function performs all appropriate clean-up, but doesn't actually exit.
- It should be called before initiating an unsafe exit, e.g. before calling
- "Launch".
-
- "_exiting" takes an argument indicating whether the clean-up should be
- that associated with a normal or an abnormal exit. A non-zero argument
- indicates a normal exit.
-
- If your application never calls "onexit" or "_onexit" (and doesn't use
- stdio, the profiler, or "signal", which do), AND if your application is
- not built with "Separate STRS", then you needn't bother with "_exiting".
-
- The "exec" series of standard library functions call "_exiting(1)".
-
-
- CHANGES FROM 3.01p4 to 3.02
- ---------------------------
-
- There are no substantive changes in this release. However, if you'd like
- to update your libraries, here's how:
-
- (1) Remove the "Config Headers" folder completely. It is no
- longer used.
-
- (2) Remove the line
-
- #include "config.h"
-
- from the following files:
-
- printf-2-w.c
- printf-3.c
- scanf2.c
- unixatof.c
-
- (3) If desired, insert the line
-
- #define _HALFWINDOW_
-
- in printf-2-w.c where the #include "config.h" used to be.
- (This #define causes the console window to be half-height
- under MultiFinder, to make room for the debugger's windows.)
-
- (4) In stdver.c, change the version number from 3.01p4 to 3.02.
-
- (5) Rebuild the affected projects, which are:
-
- sprintf
- sprintf881
- stdio
- stdio881
- unix
- unix881
-
- To rebuild each project, open it, bring up the "Make╔"
- dialog box, uncheck "Quick Scan", and click "Use Disk".
- Finally, click "Make".
-